package factory;

/**
 * 定义一个用于创建对象的接口，让子类决定实例化哪一个类。
 * Factory Method使一个类的实例化延迟到其子类。
 */
public class Test {
    public static void main(String[] args) {
        ShapeFactory factory1 = new CircleFactory();
        ShapeFactory factory2 = new RectangleFactory();
        Shape shape1 = factory1.createShape();
        Shape shape2 = factory2.createShape();
        shape1.draw();
        shape2.draw();
    }
}